#include "trans.h"


int recvCmd(int sockfd, char *buf, int *flag){


    train_t train;
    recv(sockfd,&train.flag,sizeof(train.flag),0);
    recv(sockfd,&train.length,sizeof(train.length),0);
    recv(sockfd,train.data,train.length,0);
    printf("memcpy before : flag = %s, buf = %s\n",(char*)flag,buf);
    memcpy(flag,&train.flag,sizeof(train.flag));
    memcpy(buf,train.data,sizeof(train.data));
    buf[strlen(buf)-1] = '\0';
    printf("memcpy after :flag = %s, buf = %s\n",(char*)flag,buf);



    return 0;
}
